package com.student.db;


import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import java.util.List;

import io.reactivex.rxjava3.core.Completable;
import io.reactivex.rxjava3.core.Flowable;

@Dao
public interface PunchDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    public Completable insert(PunchEntity punchEntity);



    @Query("SELECT * FROM db_punch  ORDER BY punchTime DESC")
    public Flowable<List<PunchEntity>> getPunch();



    @Query("SELECT * FROM db_punch WHERE ((:startTime=0 or :endTime=0  or (punchTime >= :startTime AND punchTime <= :endTime)) AND type=1)  ORDER BY punchTime DESC")
    public Flowable<List<PunchEntity>> searchPunch(long startTime,long endTime);

}
